#!/usr/bin/evn python

from google.appengine.ext import db
from models import *

# PAN-TILT-ZOOM OBJECTS

class PTZScene(Scene):
	sourceURL          = db.StringProperty(required=True)
	codeBaseURL        = db.StringProperty(required=True)
	baseURL            = db.StringProperty(required=True)
	panLeftRange       = db.FloatProperty(required=True)
	panRightRange      = db.FloatProperty(required=True)
	tiltUpRange        = db.FloatProperty(required=True)
	tiltDownRange      = db.FloatProperty(required=True)
	zoomInRange        = db.FloatProperty(required=True)
	zoomOutRange       = db.FloatProperty(required=True)
	cameraType         = db.StringProperty(required=True)
	totalPanDegrees    = db.FloatProperty()
	totalTiltDegrees   = db.FloatProperty()
	
class PTZCorrespondence(Correspondence):
	pan       = db.IntegerProperty(required=True)
	tilt      = db.IntegerProperty(required=True)
	zoom      = db.IntegerProperty(required=True)
	
class PTZCalibration(db.Model):
	scene             = db.ReferenceProperty(PTZScene, required=True)
	originLatitude     = db.FloatProperty(required=True)
	originLongitude    = db.FloatProperty(required=True)
	originAltitude     = db.FloatProperty(required=True)
	panOffsetRad       = db.FloatProperty(required=True)
	tiltOffsetRad      = db.FloatProperty(required=True)
	rollOffsetRad      = db.FloatProperty(required=True)
	tx                = db.FloatProperty(required=True)
	ty                = db.FloatProperty(required=True)
	tz                = db.FloatProperty(required=True)
	averageError      = db.FloatProperty(default=-1.0)
	focalLengthF1     = db.FloatProperty()
	focalLengthF2     = db.FloatProperty()
	focalLengthF3     = db.FloatProperty()
	

	
